package com.itheima.controller;

import com.itheima.pojo.Result;
import com.itheima.service.BaiDuWeatherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

// 调用百度天气接口
@RestController
@RequestMapping("/baidu")
public class BaiDuWeatherController {
    @Autowired
    private BaiDuWeatherService baiDuWeatherService;
    // 获取天气信息
    @GetMapping("/weather")
    public Result getBaiDuWeather(){
        String weather = baiDuWeatherService.getWeather();
        // 返回天气信息
        System.out.println(weather);
        return Result.success(weather);
    }
}
